package com.bdqn.service.impl;

import com.bdqn.mapper.DepartmentMapper;
import com.bdqn.pojo.Department;
import com.bdqn.pojo.Role;
import com.bdqn.service.DepartmentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    DepartmentMapper departmentMapper;
    public PageInfo<Department> selectPage(int pageNum, int pageSize, String deptName){
        //开始分页,设置当前页的页号和每页显示的条数
        PageHelper.startPage(pageNum,pageSize);
        //获取所有的角色信息
        List<Department> list=departmentMapper.select(deptName);
        //获取当前页的信息对象
        PageInfo<Department> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<Department> getRegistrationList() {
        return departmentMapper.selectRegistrationList();
    }

}
